home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / MATH / MATLAB.ZIP / DEMO next >
Text File  |  1985-11-10  |  574b  |  21 lines

  1. //Eigenvalue sensitivity example. See section 8 of the Users' Guide.
  2. B = <3 0 7; 0 2 0; 0 0 1>
  3. L = <1 0 0; 2 1 0; -3 4 1>,  M = L\L'
  4. A = M*B/M
  5. A = round(A)
  6. <X,D> = eig(A)
  7. long,  diag(D),  short
  8. cond(X)
  9. X = X/diag(X(3,:)),  cond(X)
  10. Y = inv(X'),  Y'*A*X
  11. for j = 1:3, c(j) = norm(Y(:,j))*norm(X(:,j));
  12. C
  13. E = -1.e-6*Y(:,1)*X(:,1)'
  14. eig(A + .4*E),  eig(A + .5*E)
  15. r = .4;  s = .5;
  16. while s-r > 1.e-14, t = (r+s)/2; d = eig(A+t*E); ...
  17.   if imag(d(1))=0, r = t; else, s = t;
  18. long,  t = r
  19. A+t*e,  eig(A+t*E)
  20. <X,D> = eig(A+t*E);  X = X/diag(X(3,:))
  21. short,  cond(X)